<template>
  <t-image-viewer v-if="!store.isMobileType" v-model:visible="ImgVisible" :images="[urls + props.info.value]">
  </t-image-viewer>
  <van-image-preview :show-index="false" v-else v-model:show="ImgVisible" :images="[urls + props.info.value]">
  </van-image-preview>
  <div class="outline-parent">
    <div
      class="content-parent border-hover-style"
      :style="{ backgroundImage: `url(${publicUrls + 'free/style5/Auxiliaryoutlinestyle1Bg.webp'})` }"
    >
      <div class="audio-parent">
        <audioCom :info="props.info" ref="audioParent" />
      </div>

      <div
        class="content"
        :class="{ content2: !props.info.remarks && !props.info.subTitle && !props.info.video.url && !props.info.value }"
      >
        <div
          class="title-box"
          :class="{ 'title-box-sb': props.info.text.length > 8 }"
          v-html="textType(props.info.text)"
        ></div>
        <div
          class="content-right"
          v-if="
            props.info.remarks || props.info.subTitle || (props.info.video && props.info.video.url) || props.info.value
          "
        >
          <p class="subtitle" v-if="props.info.subTitle">——{{ props.info.subTitle }}</p>
          <div
            v-if="(props.info.video && props.info.video.url) || props.info.value"
            class="img-box"
            :class="{
              'img-box1': props.info.remarks && props.info.subTitle,
              'img-box2': props.info.remarks && !props.info.subTitle,
              'img-box3': !props.info.remarks && props.info.subTitle,
              'img-box4': !props.info.remarks && !props.info.subTitle,
            }"
          >
            <videoview
              @click="audioplay(false)"
              :info="props.info"
              v-if="props.info.video && props.info.video.url"
            ></videoview>
            <div v-else class="outline-cover">
              <img @click="ImgVisible = true" :src="urls + props.info.value + '?imageView2/3/format/webp'" alt="" />
            </div>
          </div>

          <div class="remarks1" v-if="(props.info.video && props.info.video.url) || props.info.value">
            <TextMax
              :color2="false"
              :infoData="props.info"
              v-if="props.domShow"
              :data="props.info.remarks"
              :title="props.info.text"
              :row="2"
            ></TextMax>
          </div>
          <div class="remarks2" v-else-if="props.info.remarks">
            <TextMax
              :color2="false"
              :infoData="props.info"
              v-if="props.domShow"
              :data="props.info.remarks"
              :title="props.info.text"
              :row="props.info.subTitle ? 6 : 8"
            ></TextMax>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>



<script setup lang="ts">
import audioCom from './audioCom.vue';
import { publicUrls, textType } from '@/utils/minxin';
import { useProjectStore } from '@/store';
import { urls } from '@/utils/request/upload';
import { defineComponent, ref } from 'vue';
import TextMax from '@/freeComponents/textMode/TextMax5.vue';
import videoview from './../../../videoDialog/videoview.vue';

const props = defineProps({
  info: {
    type: Object,
  },
  domShow: {
    type: Boolean,
  },
});

const ImgVisible = ref(false);
const audioRef = ref(null);
const audioParent = ref(null);
const videoRef = ref(null);
const isPlay = ref(false);
const store = useProjectStore();
const audioplay = (flag: boolean = true) => {
  audioParent.value.videoplay();
};
</script>

<style scoped lang="less">
.outline-parent {
  display: flex;
  // align-items: flex-end;
  position: relative;
  margin-top: 0;
  height: 100%;
  margin-right: 140px;
}
.content-parent {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-top: 0px;
  width: 510px;
  height: 510px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  -webkit-box-reflect: below 34% linear-gradient(transparent, rgba(0, 0, 0, 0.15));
}
.audio-parent {
  position: absolute;
  bottom: 30px;
  right: 30px;
  width: 40px;
  height: 40px;
}
.content {
  position: relative;
  display: flex;
  align-items: center;
  width: 332px;
  height: 266px;
}
.content2 {
  justify-content: center;
}
.title-box {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 46px;
  height: 224px;
  :deep(p) {
    width: 20px;
    font-family: SourceBold;
    font-size: 20px;
    color: rgba(63, 95, 92, 1);
    line-height: 28px;
    text-align: center;
  }
}
.title-box-sb {
  justify-content: space-between;
}
.content-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  height: 100%;
  margin-left: 12px;
  padding-left: 15px;
  border-left: 2px solid rgba(63, 95, 92, 0.2);
}
.subtitle {
  width: 100%;
  font-family: SourceMedium;
  font-size: 16px;
  color: rgba(63, 95, 92, 1);
  line-height: 28px;
  text-align: center;
  font-weight: 400;
}
.img-box {
  position: relative;
  overflow: hidden;
  background: rgba(144, 165, 157, 0.2);
  width: 259px;
  :deep(video) {
    background: rgba(0, 0, 0, 0.3);
  }
  .outline-cover {
    width: 100%;
    height: 100%;
    object-fit: contain;
    overflow: hidden;
    img { 
      transition: all 0.3s;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }
  }
}
.img-box:hover {
  .outline-cover { 
    img { 
      transform: scale(1.2);
    }
  }
}
.img-box1 {
  display: flex;

  height: 126px;
  margin-top: 10px;
}
.img-box2 {
  height: 192px;
  margin-top: 0px;
}
.img-box3 {
  height: 162px;
  margin-top: 10px;
}
.img-box4 {
  height: 224px;
  margin-top: 21px;
}

.remarks1 {
  width: 259px;
  margin-top: 10px;
  :deep(.van-text-ellipsis) {
  }
}
.remarks2 {
  width: 259px;
  margin-top: 10px;
}
</style>
